package homework01;
import java.util.Random;
import java.util.Scanner;
public class Test04 {
    public static void main(String[] args) {
        guessNum();
    }
    public static void guessNum(){
        int num=new Random().nextInt(100)+1;
        System.out.println(num);
        while (true) {
            System.out.println("请输入您要猜的数");
            int guessNum = new Scanner(System.in).nextInt();
            if (num==guessNum){
                System.out.println("恭喜你！猜对了");break;
            }
        }
    }
}
